package io.gitee.oss.helper.client;

import io.gitee.oss.helper.config.ConfigTuple;
import lombok.Getter;
import org.apache.commons.pool2.BasePooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;

/**
 * 客户端对象池抽象基础
 * <p>
 * Copyright © 2023 shenzizai All Rights Reserved
 **/
@Getter
public abstract class AbstractClientObjectPooledFactory<T> extends BasePooledObjectFactory<T> {

    /**
     * 配置元组
     */
    private final ConfigTuple tuple;

    protected AbstractClientObjectPooledFactory(ConfigTuple tuple) {
        this.tuple = tuple;
    }

    @Override
    public PooledObject<T> wrap(T obj) {
        return new DefaultPooledObject<>(obj);
    }
}
